package com.gitee.Transformation

import org.apache.flink.api.scala.ExecutionEnvironment

/*
  根据条件过滤
 */
object FilterTest {
  def main(args: Array[String]): Unit = {
    val env: ExecutionEnvironment = ExecutionEnvironment.getExecutionEnvironment
    import org.apache.flink.api.scala._
    env.setParallelism(1)
    case class User(id: String, name: String)
    val lineData: DataSet[String] = env.fromElements("1,张三", "2,李四", "3,王五", "4,赵六")

    //等于1的 1个
    lineData.filter(_.split(",")(0) == "1").print()
    //大于1的 3个
    lineData.filter(_.split(",")(0) > "1").print()
    //小于1的 0个
    lineData.filter(_.split(",")(0) < "1").print()


  }

}
